<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : studentFO.xsl
    Created on : February 22, 2013, 2:28 PM
    Author     : trungnm
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>
    <xsl:template match="/">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="first"
                                       page-height="29.7cm"
                                       page-width="30cm"
                                       margin-top="1cm"
                                       margin-bottom="2cm"
                                       margin-left="2.5cm"
                                       margin-right="2.5cm">
                    <fo:region-body margin-top="3cm"/>
                    <fo:region-before extent="3cm"/>
                    <fo:region-after extent="1.5cm"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="first">
                <fo:static-content flow-name="xsl-region-before">
                    <fo:block>
                        <fo:external-graphic src=""/>
                    </fo:block>
                    <fo:block font-size="30pt" margin-top="1cm" font-family="Arial"
                line-height="24pt"
                space-after.optimum="15pt" text-align="center"
                padding-top="3pt">Funny Fashion
                    </fo:block>
                </fo:static-content>

                <fo:static-content flow-name="xsl-region-after">
                    <fo:block font-size="18pt" font-family="Arial"
                line-height="24pt" space-after.optimum="15pt"
                text-align="center" padding-top="3pt">
                    </fo:block>
                </fo:static-content>

                <fo:flow flow-name="xsl-region-body" >
                    <fo:block font-family="Arial">
                        <fo:block>Khách hàng:<xsl:value-of select="orderDetails/orderDetail/fullname"/></fo:block>
                        <fo:block> Địa chỉ nhận hàng: <xsl:value-of select="orderDetails/orderDetail/address"/></fo:block>
                        <fo:block>Số điện thoại: <xsl:value-of select="orderDetails/orderDetail/phone"/></fo:block>
                        <fo:table border-collapse="separate">
                            <fo:table-column column-width="5cm"/>
                            <fo:table-column column-width="5cm"/>
                            <fo:table-column column-width="5cm"/>
                            <fo:table-column column-width="5cm"/>
                            <fo:table-column column-width="5cm"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                        <fo:block text-align="center">No.</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                        <fo:block font-family="Arial" text-align="center">Tên sản phẩm</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                        <fo:block font-family="Arial" text-align="center">Đơn giá</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                        <fo:block font-family="Arial" text-align="center">Số lượng</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                        <fo:block font-family="Arial" text-align="center">Thành tiền</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <xsl:for-each select="orderDetails/orderDetail">
                                    <fo:table-row>
                                        <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                            <fo:block font-family="Arial" text-align="center">
                                                <xsl:number level="single" count="orderDetail"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                            <fo:block font-family="Arial" text-align="center">
                                                <xsl:value-of select="productName"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                            <fo:block text-align="center">
                                                <xsl:value-of select="price"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                            <fo:block text-align="center">
                                                <xsl:value-of select="quantity"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="blue"
                                        border-width="0.5pt" border-style="solid">
                                            <fo:block text-align="center">
                                                <xsl:value-of select="total"/>
                                            </fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                </xsl:for-each>
                            </fo:table-body>
                        </fo:table>
                        <fo:block margin-top="1cm" margin-right="2cm" font-family="Arial" font-weight="bold" font-size="14pt" text-align="right">
                                                Tổng đơn hàng:
                            <xsl:value-of select="orderDetails/orderDetail/orderTotal"/>
                        </fo:block>
                        
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>

</xsl:stylesheet>
